package cn.com.nes.site.action.points;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.nes.common.util.DBUtils;
import cn.com.nes.site.entity.DataReq;
import cn.com.nes.site.entity.DataRes;
import cn.com.nes.site.entity.PageData;
import cn.com.nes.site.module.service.PointsService;

@Controller("points")
@RequestMapping("/points")
public class PointsAction  {
	@Resource
    private PointsService service;
	
	/**
	 * 获取线索分析数据
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(method = {RequestMethod.POST}, value = "/calUserPoints")
	public @ResponseBody PageData calUserPoints(HttpServletRequest request, HttpServletResponse response) {
		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
		PageData res = new PageData() ;
		if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
		DataReq req = req_Status.getReq();
        res = service.calUserPoints() ;
        return res;
	}

//	/**
//	 * 用户注册时候，创建默认数据
//	 * @param request
//	 * @param response
//	 * @return
//	 */
//	@RequestMapping(method = {RequestMethod.POST}, value = "/createDemoData")
//	public @ResponseBody PageData createDemoData(HttpServletRequest request, HttpServletResponse response) {
//		DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
//		PageData res = new PageData() ;
//		if (req_Status.getRetCode() != 0) {
//            res = new PageData();
//            res.setRetCode(req_Status.getRetCode()) ;
//            res.setRetMessage(req_Status.getRetMessage());
//            return res;
//        }
//		DataReq req = req_Status.getReq();
//        res = service.createDemoData(req) ;
//        return res;
//	}
	
}
